package com.qf.dao;

import com.qf.pojo.entity.TbPermission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TbPermissionRepository extends JpaRepository<TbPermission,Integer> {
    @Query(value = "SELECT tp.pr_name FROM tb_permission tp," +
            "tb_admin ta,tb_role tr, tb_admin_role tar,tb_role_press trp" +
            " WHERE tp.pr_id = trp.pr_id" +
            " AND trp.ro_id = tr.ro_id " +
            "AND tr.ro_id = tar.ro_id " +
            "AND tar.ad_id = ta.adid " +
            "AND ta.adname = ?1",nativeQuery = true)
    List<String> findPermissionNameByAdName(String adName);
}
